<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>

<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>导出门店会员及会员相关文件</title>
<%@include file="../include/include.jsp"%>
<link rel="stylesheet" type="text/css" href="${csspath }/public.css" />
<script type="text/javascript" src="${layerPath}/jquery/jquery-1.8.3.js"></script>
<link rel="stylesheet" type="text/css"
	href="${bootstrapPath}/css/bootstrap.css" />
<script type="text/javascript" src="${bootstrapPath}/js/bootstrap.js"></script>
<script type="text/javascript"
	src="${bootstrapPath}/js/bootstrap3-validation.js"></script>
	
<script type="text/javascript">
	$(function(){
		$("#exportMember").click(function(){
			if($("#dealerNum").val() == ""){
				jAlert("请输入门店号","提示信息");
				return;
			}
			$.ajax({
				type : 'POST',
				url : '${webcontext}/crmdp/dealer/masterdata/checkMemberExist',
				async : false,
				data : $('#export_member').serialize(),
				dataType : 'json',
				success : function(data) {
					if(!data){
						jAlert("您所输入的门店不存在！","提示信息");
						return;
					}
					if(data){
						$('#export_member').attr("action","${webcontext}/crmdp/dealer/masterdata/exportMember");
						$('#export_member').submit();
					}
				},
				error: function(data) {
                    alert("系统错误,请检查门店号并重试","提示信息");
                 }
			});
		});
		
		$("#exportPortfolio").click(function(){
			if($("#dealerNum").val() == ""){
				jAlert("请输入门店号","提示信息");
				return;
			}
			$.ajax({
				type : 'POST',
				url : '${webcontext}/crmdp/dealer/masterdata/checkMemberExist',
				async : false,
				data : $('#export_member').serialize(),
				dataType : 'json',
				success : function(data) {
					if(!data){
						jAlert("您所输入的门店不存在！","提示信息");
						return;
					}
					if(data){
						$('#export_member').attr("action","${webcontext}/crmdp/dealer/masterdata/exportPortfolio");
						$('#export_member').submit();
					}
				},
				error: function(data) {
                    alert("系统错误","提示信息");
                 }
			});
		});
	})
</script>
</head>
<style>
</style>
<body>
	<div class="main" style="margin-top: 10px;">
		<form:form class="form-horizontal" id="export_member" method="post"
			action="" modelAttribute="submitDto" role="form"
			enctype="multipart/form-data">
			<div id="tell" class="form-group has-feedback">
				<label for="dealerNumber" class="col-sm-1 control-label labelShow">门店号</label>
				<div class="col-sm-2 inputDiv">
					<input type="text" class="form-control" id="dealerNum" name="dealerNum" value="${dealerNum}">
				</div>
				
				<div class="col-sm-2"  style="width: 150px;">
					<button type="button" class="btn btn-success" id="exportMember" style="width: 120px;">
						<i class="glyphicon glyphicon-ok" style="color: #FFFFFF"></i>会员数据导出
					</button>
				</div>
				<div class="col-sm-2">
					<button type="button" class="btn btn-success" id="exportPortfolio" style="width: 150px;">
						<i class="glyphicon glyphicon-ok" style="color: #FFFFFF"></i>会员套餐数据导出
					</button>
				</div>
			</div>
		</form:form>
	</div>
</body>
</html>